import Inula, { useState, useEffect } from 'openinula'


export default function Location() {
  const [user, setUser] = useState('user');

  const handleJump = () => {
    window.$wujie?.props.jump('inulaComponent');
  }

  const handleRandomUser = () => {
    if (user === 'user') {
      setUser('admin')
    } else {
      setUser('user');
    }
  }

  useEffect(() => {
    console.log(user);
    window?.$wujie?.bus.$on("change_user_type", () => (() => handleRandomUser()));
  }, [])
  return <div>rank <p>用户类型：{user}</p>
    <button onClick={handleRandomUser}>更换用户类型</button><button onClick={handleJump} style={{ marginLeft: '20px' }}>跳转到应用市场</button></div>
}